package com.easilyj.service.impl;

import com.easilyj.bean.User;
import com.easilyj.dao.UserDao;
import com.easilyj.service.UserService;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
@CacheConfig(cacheNames = "user")
public class UserServiceImpl implements UserService {

    @Resource
    private UserDao userDao;

    @Override
    public User save(User user) {
        return userDao.save(user);
    }

    @Override
    public User getOne(Long userId) {
        return userDao.getOne(userId);
    }

    @Override
    public User findByUserEmail(String userEmail) {
        return userDao.findByUserEmail(userEmail);
    }

    @Override
    public User findByUserName(String userName) {
        return userDao.findByUserName(userName);
    }
}
